* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
    height: calc(100vh - 40px);
}

.panel {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

.characters-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.character-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.character-card.active {
    border-color: #e62429;
    background: rgba(230, 36, 41, 0.2);
}

.character-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.character-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.character-description {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-panel {
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: rgba(41, 128, 185, 0.3);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.character-message {
    background: rgba(230, 36, 41, 0.2);
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.message-content {
    line-height: 1.4;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 25px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.chat-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

.send-button {
    background: #e62429;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-button:hover {
    background: #c11a1e;
    transform: scale(1.05);
}

.config-panel h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.config-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.config-section:last-child {
    border-bottom: none;
}

.config-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.select-input, .text-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.9rem;
}

.select-input:focus, .text-input:focus {
    outline: none;
    border-color: #e62429;
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.skill-button {
    padding: 6px 12px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.skill-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.skill-button.active {
    background: #e62429;
    border-color: #e62429;
}

.api-key-container {
    display: none;
}

.fallback-checkbox {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.app-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
    
    .characters-panel {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .character-card {
        min-width: 250px;
    }
}